from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager


class DriverTools(object):
    _driver = None

    @classmethod
    def get_driver(cls):
        if cls._driver == None:
            cls._driver = webdriver.Chrome(ChromeDriverManager().install())
            cls._driver.maximize_window()
            cls._driver.implicitly_wait(3)
        return cls._driver

    @classmethod
    def quit_driver(cls):
        if cls._driver:
            cls._driver.quit()
            cls._driver = None


if __name__ == '__main__':
    DriverTools.get_driver().get("http://hmshop-test.itheima.net/")
    DriverTools.quit_driver()